home *** CD-ROM | disk | FTP | other *** search
/ PC Direct 1998 August / PC Direct August 1998.iso / S / powerj / Product / hpp.z / wgrid.hpp < prev    next >
Encoding:
C/C++ Source or Header  |  1997-11-25  |  18.5 KB  |  568 lines

  1. /*
  2.     WGrid.hpp
  3.  
  4.     NOTE: This file is a generated file.
  5.           Do not modify it by hand!
  6. */
  7.  
  8. #ifndef _WGRID_HPP_INCLUDED
  9. #define _WGRID_HPP_INCLUDED
  10.  
  11.  
  12. // Declarations added here will be included at the top of the .HPP file
  13.  
  14. #include "WGridD.hpp"
  15.  
  16. #ifndef _WTEXTBOX_HPP_INCLUDED
  17. #  include "wtextbox.hpp"
  18. #endif
  19. #ifndef _WCOMBOX_HPP_INCLUDED
  20. #  include "wcombox.hpp"
  21. #endif
  22. #ifndef _WMASKTB_HPP_INCLUDED
  23. #  include "wmasktb.hpp"
  24. #endif
  25.  
  26. /*************************************************************************
  27.  *
  28.  * WGrid -- Base Grid class
  29.  *
  30.  *
  31.  *   Events:
  32.  *
  33.  *       BeginLabelEdit --
  34.  *
  35.  *       Click --
  36.  *
  37.  *       DataAvailable --
  38.  *
  39.  *       DataClose --
  40.  *
  41.  *       DataOpen --
  42.  *
  43.  *       DataRequest --
  44.  *
  45.  *       DoubleClick --
  46.  *
  47.  *       EndLabelEdit --
  48.  *
  49.  *       InsertItem -- Called immediately after an item is added.
  50.  *
  51.  *       Select -- Called immediately after an item is selected.
  52.  *
  53.  ************************************************************************/
  54.  
  55. struct WGridEventData : public WEventData {
  56.     WULong      rowNumber;
  57.     WULong      columnNumber;
  58.     WString     text;
  59. };
  60.  
  61. struct WGridUserData {
  62.     WLong           row;
  63.     void *          userData;
  64. };
  65.  
  66. #pragma warning 849 9
  67.  
  68. class WGrid;
  69.  
  70. class WCMCLASS WGridComboBox : public WComboBox
  71. {
  72.     WDeclareSubclass( WGridComboBox, WComboBox );
  73.  
  74.     public:
  75.         WGridComboBox( WGrid * grid=NULL ) { _grid = grid; };
  76.         ~WGridComboBox() {};
  77.         
  78.     public:
  79.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  80.         virtual WBool Move( const WRect & rectangle, WBool update=TRUE );
  81.         virtual WBool Move( const WRect & rectangle, WDeferMoveHandle & dwp );
  82.         virtual WBool Move( const WPoint & point, WBool update=TRUE );
  83.         virtual WBool Move( const WPoint & point, WDeferMoveHandle & dwp );
  84.  
  85.     private:
  86.         WGrid *         _grid;
  87. };
  88.  
  89. class WCMCLASS WGridMaskedTextBox : public WMaskedTextBox
  90. {
  91.     WDeclareSubclass( WGridMaskedTextBox, WMaskedTextBox );
  92.  
  93.     public:
  94.         WGridMaskedTextBox( WGrid * grid=NULL ) { _grid = grid; };
  95.         ~WGridMaskedTextBox() {};
  96.         
  97.     public:
  98.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  99.  
  100.     private:
  101.         WGrid *         _grid;
  102. };
  103.  
  104. class WCMCLASS WGridTextBox : public WTextBox
  105. {
  106.     WDeclareSubclass( WGridTextBox, WTextBox );
  107.  
  108.     public:
  109.         WGridTextBox( WGrid * grid=NULL ) { _grid = grid; };
  110.         ~WGridTextBox() {};
  111.         
  112.     public:
  113.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  114.  
  115.     private:
  116.         WGrid *         _grid;
  117. };
  118.  
  119. class WCMCLASS WGrid : public WControl
  120. {
  121.     WDeclareSubclass( WGrid, WControl );
  122.  
  123.         /**************************************************************
  124.          * Constructors and destructors
  125.          **************************************************************/
  126.     public:
  127.  
  128.         WGrid();
  129.  
  130.         ~WGrid();
  131.  
  132.         /**************************************************************
  133.          * Properties
  134.          **************************************************************/
  135.  
  136.         // UseArray
  137.         //
  138.         //  Note: Changing this property deletes existing data
  139.  
  140.         WBool GetUseArray() const;
  141.         WBool SetUseArray( WBool useArray );
  142.  
  143.         // ColumnCount
  144.  
  145.         WULong GetColumnCount() const;
  146.         WBool SetColumnCount( WULong columnCount=0xFFFFFFFFL );
  147.  
  148.         // DataColumns
  149.  
  150.         WString GetDataColumns() const;
  151.         WBool SetDataColumns( const WString & columns );
  152.  
  153.         // DataGuardRows
  154.  
  155.         WLong GetDataGuardRows() const;
  156.         WBool SetDataGuardRows( WLong guardRows );
  157.  
  158.         // DataKeptRows
  159.  
  160.         WLong GetDataKeptRows() const;
  161.         WBool SetDataKeptRows( WLong keptRows );
  162.  
  163.         // DataSource
  164.  
  165.         WDataSource * GetDataSource() const;
  166.         WBool SetDataSource( WDataSource * source );
  167.  
  168.         // DataTargetTable
  169.         WDataTargetTable * GetDataTargetTable() const;
  170.  
  171.         // DefaultColumnWidth
  172.  
  173.         WInt GetDefaultColumnWidth() const;
  174.         WBool SetDefaultColumnWidth( WInt defaultColumnWidth,
  175.                                      WBool repaint=TRUE );
  176.  
  177.         // DefaultRowHeight
  178.  
  179.         WInt GetDefaultRowHeight() const;
  180.         WBool SetDefaultRowHeight( WInt defaultRowHeight,
  181.                                    WBool repaint=TRUE );
  182.  
  183.         // Editor
  184.  
  185.         WWindow * GetEditor() const;
  186.         WBool SetEditor( WWindow * editor, WBool deleteOld=TRUE );
  187.  
  188.         // FullRowSelection
  189.  
  190.         WBool GetFullRowSelection() const;
  191.         WBool SetFullRowSelection( WBool fullRowSelection );
  192.  
  193.         // HorizontalHeaderHeight
  194.  
  195.         WBool SetHorizontalHeaderHeight( WShort headerHeight );
  196.         WShort GetHorizontalHeaderHeight() const;
  197.  
  198.         // LeftColumnNumber
  199.  
  200.         WULong GetLeftColumnNumber() const;
  201.         WBool SetLeftColumnNumber( WULong columnNumber );
  202.  
  203.         // LiveEditMode
  204.  
  205.         WBool GetLiveEditMode() const;
  206.         WBool SetLiveEditMode( WBool liveEditMode=TRUE );
  207.  
  208.         // LiveScrollMode
  209.  
  210.         WBool GetLiveScrollMode() const;
  211.         WBool SetLiveScrollMode( WBool liveScrollMode=TRUE );
  212.  
  213.         // MultipleSelection
  214.  
  215.         WBool SetMultipleSelection( WBool multipleSelection );
  216.         WBool GetMultipleSelection() const;
  217.  
  218.         // ReadOnly
  219.  
  220.         WBool GetReadOnly() const;
  221.         WBool SetReadOnly( WBool readOnly );
  222.  
  223.         // ResizableColumns
  224.  
  225.         WBool SetResizableColumns( WBool resizableColumns );
  226.         WBool GetResizableColumns() const;
  227.  
  228.         // ResizableRows
  229.  
  230.         WBool SetResizableRows( WBool resizableRows );
  231.         WBool GetResizableRows() const;
  232.  
  233.         // RowCount
  234.  
  235.         WULong GetRowCount() const;
  236.         WBool SetRowCount( WULong rowCount=0xFFFFFFFFL );
  237.  
  238.         // SelectedColumnNumber
  239.  
  240.         WULong GetSelectedColumnNumber() const;
  241.         WBool SetSelectedColumnNumber( WULong columnNumber,
  242.                                        WBool repaint=TRUE,
  243.                                        WBool scrollIntoView=TRUE );
  244.  
  245.         // SelectedEndColumnNumber
  246.  
  247.         WULong GetSelectedEndColumnNumber() const;
  248.         WBool SetSelectedEndColumnNumber( WULong columnNumber,
  249.                                           WBool repaint=TRUE );
  250.  
  251.         // SelectedEndRowNumber
  252.  
  253.         WULong GetSelectedEndRowNumber() const;
  254.         WBool SetSelectedEndRowNumber( WULong rowNumber, WBool repaint=TRUE );
  255.  
  256.         // SelectedRowNumber
  257.  
  258.         WULong GetSelectedRowNumber() const;
  259.         WBool SetSelectedRowNumber( WULong rowNumber, WBool repaint=TRUE,
  260.                                     WBool scrollIntoView=TRUE );
  261.  
  262.         // ShowColumnLines
  263.  
  264.         WBool SetShowColumnLines( WBool showColumnLines=TRUE );
  265.         WBool GetShowColumnLines() const;
  266.  
  267.         // ShowRowLines
  268.  
  269.         WBool SetShowRowLines( WBool showRowLines=TRUE );
  270.         WBool GetShowRowLines() const;
  271.  
  272.         // ShowHorizontalHeader
  273.  
  274.         WBool GetShowHorizontalHeader() const;
  275.         WBool SetShowHorizontalHeader( WBool showHorizontalHeader,
  276.                                        WBool repaint=TRUE );
  277.  
  278.         // ShowVerticalHeader
  279.  
  280.         WBool GetShowVerticalHeader() const;
  281.         WBool SetShowVerticalHeader( WBool showVerticalHeader,
  282.                                      WBool repaint=TRUE );
  283.  
  284.         // TopRowNumber
  285.  
  286.         WULong GetTopRowNumber() const;
  287.         WBool SetTopRowNumber( WULong rowNumber );
  288.  
  289.         // UseTabs
  290.  
  291.         WBool SetUseTabs( WBool useTabs );
  292.         WBool GetUseTabs() const;
  293.  
  294.         // VerticalHeaderWidth
  295.  
  296.         WBool SetVerticalHeaderWidth( WShort headerWidth );
  297.         WShort GetVerticalHeaderWidth() const;
  298.  
  299.         // VisibleColumnCount
  300.  
  301.         WULong GetVisibleColumnCount() const;
  302.  
  303.         // VisibleRowCount
  304.  
  305.         WULong GetVisibleRowCount() const;
  306.  
  307.         // DataTrackRow
  308.  
  309.         WBool GetDataTrackRow() const;
  310.         WBool SetDataTrackRow( WBool trackRow );
  311.  
  312.         // CancelEdittingOnLostFocus
  313.  
  314.         WBool GetCancelEdittingOnLostFocus() const;
  315.         WBool SetCancelEdittingOnLostFocus( WBool cancelEditting );
  316.  
  317.         /**************************************************************
  318.          * Item Properties
  319.          **************************************************************/
  320.  
  321.         // ColumnTitle
  322.  
  323.         WBool SetColumnTitle( WULong columnNumber,
  324.                               const WString & columnTitle,
  325.                               WBool repaint=FALSE );
  326.         WString GetColumnTitle( WULong columnNumber ) const;
  327.  
  328.         // ColumnWidth
  329.  
  330.         WBool SetColumnWidth( WULong columnNumber, WInt columnWidth );
  331.         WInt GetColumnWidth( WULong columnNumber ) const;
  332.  
  333.         // ReadOnly
  334.  
  335.         WBool SetReadOnly( WULong rowNumber, WULong columnNumber,
  336.                            WBool readOnly );
  337.         WBool SetReadOnly( WULong columnNumber, WBool readOnly );
  338.         WBool GetReadOnly( WULong rowNumber, WULong columnNumber ) const;
  339.         WBool GetReadOnly( WULong columnNumber ) const;
  340.  
  341.         // Rectangle
  342.  
  343.         WRect GetRectangle( WULong rowNumber, WULong columnNumber );
  344.  
  345.         // RowTitle
  346.  
  347.         WBool SetRowTitle( WULong rowNumber, const WString & rowTitle,
  348.                            WBool repaint=FALSE );
  349.         WString GetRowTitle( WULong rowNumber ) const;
  350.  
  351.         // RowHeight
  352.  
  353.         WBool SetRowHeight( WULong rowNumber, WInt rowHeight );
  354.         WInt GetRowHeight( WULong rowNumber ) const;
  355.  
  356.         // Text
  357.  
  358.         WBool SetText( WULong rowNumber, WULong columnNumber,
  359.                        const WString & text, WBool createIfDoesntExist=TRUE,
  360.                        WBool repaint=TRUE );
  361.         WString GetText( WULong rowNumber, WULong columnNumber ) const;
  362.  
  363.         // UserData
  364.  
  365.         WBool SetUserData( WULong rowNumber, WULong columnNumber,
  366.                            void * userData );
  367.         void * GetUserData( WULong rowNumber, WULong columnNumber ) const;
  368.  
  369.         /**************************************************************
  370.          * Methods
  371.          **************************************************************/
  372.  
  373.         // AddRow
  374.  
  375.         WBool AddRow( WULong rowNumber=0xFFFFFFFFL );
  376.  
  377.         // CreateComboBoxEditor
  378.  
  379.         WGridComboBox * CreateComboBoxEditor( WBool set=TRUE );
  380.  
  381.         // CreateMaskedTextBoxEditor
  382.  
  383.         WGridMaskedTextBox * CreateMaskedTextBoxEditor( WBool set=TRUE );
  384.  
  385.         // CreateTextBoxEditor
  386.  
  387.         WGridTextBox * CreateTextBoxEditor( WBool set=TRUE );
  388.  
  389.         // DeleteAllRows
  390.  
  391.         WBool DeleteAllRows();
  392.  
  393.         // DeleteRow
  394.  
  395.         WBool DeleteRow( WULong rowNumber );
  396.  
  397.         // EnsureColumnIsVisible
  398.  
  399.         WBool EnsureColumnIsVisible( WULong columnNumber );
  400.  
  401.         // EnsureRowIsVisible
  402.  
  403.         WBool EnsureRowIsVisible( WULong rowNumber );
  404.  
  405.         // HideEditor
  406.  
  407.         WBool HideEditor();
  408.  
  409.         // Retrieve
  410.  
  411.         WBool Retrieve( const WPoint & point, WULong & rowNumber,
  412.                         WULong & columnNumber );
  413.  
  414.         // ShowEditor
  415.  
  416.         WBool ShowEditor();
  417.  
  418.         /**************************************************************
  419.          * Overrides
  420.          **************************************************************/
  421.  
  422.         virtual WString GetText() const;
  423.  
  424.         virtual WBool SetText( const WString & text );
  425.  
  426.         virtual WStyle GetDefaultStyle() const;
  427.  
  428.         virtual WULong GetDialogCode( WUInt wParam = 0, WLong lParam = 0 );
  429.  
  430.         virtual WRect GetRectangle( WBool absolute=FALSE ) const;
  431.  
  432.         virtual WBool MakeWindow( WWindow * parent, WUInt id,
  433.                                   const WChar *className, const WChar *title,
  434.                                   const WRect & r, WStyle wstyle,
  435.                                   WStyle exStyle, void * data=NULL );
  436.  
  437.         virtual WBool LoadWindow( WWindow * parent, const WResourceID & id,
  438.                                   WModuleHandle module=_ApplicationModule );
  439.         
  440.         virtual WBool CloneWindow( WStyle newStyle, WStyle newExStyle,
  441.                                    void * data=NULL );
  442.  
  443.         /**************************************************************
  444.          * Event Handlers
  445.          **************************************************************/
  446.     
  447.         WBool TextBoxChangeEvent( WWindow * source, WEventData * ev );
  448.         WBool DataAvailableHandler( WGrid * source, WDataAvailableEventData * ev );
  449.         WBool DataCloseHandler( WGrid * source, WDataCloseEventData * event );
  450.         WBool DataGuardRowHandler( WGrid * source, WDataGuardRowEventData * ev );
  451.         WBool DataOpenHandler( WGrid * source, WDataOpenEventData * event );
  452.         WBool DataRequestHandler( WGrid * source, WDataRequestEventData * );
  453.         WBool EraseBackgroundEvent( WGrid * source, WPaintEventData * event );
  454.         WBool GetCursorEvent( WGrid * source, WGetCursorEventData * event );
  455.         WBool KeyDownEvent( WGrid * source, WKeyPressEventData * event );
  456.         WBool LeftButtonDownEvent( WGrid * source, WMouseEventData * event );
  457.         WBool LeftButtonUpEvent( WGrid * source, WMouseEventData * event );
  458.         WBool MouseMoveEvent( WGrid * source, WMouseEventData * event );
  459.         WBool PaintEvent( WGrid * source, WPaintEventData * event );
  460.         WBool ResizeEvent( WGrid * source, WResizeEventData * event );
  461.         WBool ScrollEvent( WGrid * source, WScrollBarEventData * event );
  462.         WBool TextBoxCharacterPressEvent( WWindow * source, WCharacterPressEventData * event );
  463.         WBool TextBoxKeyDownEvent( WWindow * source, WKeyPressEventData * event );
  464.         WBool TextBoxLeftButtonUpEvent( WGrid * source, WMouseEventData * event );
  465.         WBool LeftButtonDoubleEvent( WGrid * source, WMouseEventData * event );
  466.         WBool LostFocusEvent( WWindow *, WFocusEventData * );
  467.  
  468.         /**************************************************************
  469.          * Others
  470.          **************************************************************/
  471.     
  472.         WBool ChangeVerticalHeaderSize( WULong oldSize, WULong newSize,
  473.                                         WULong columnNumber );
  474.         WBool ChangeHorizontalHeaderSize( WULong oldSize, WULong newSize,
  475.                                           WULong rowNumber );
  476.         WBool SetSelected( WULong rowNumber, WULong columnNumber,
  477.                            WBool repaint=TRUE, WBool scrollIntoView=TRUE );
  478.     private:
  479.         WBool HandleRefreshRow( WLong reason, WLong currentRow,
  480.                                 WULong count );
  481.         WBool AddDataRow( WULong row, WULong rowNumber=0xFFFFFFFFL );
  482.         void RenumberDataRows();
  483.         WULong FindDataRow( WULong dbrow, WLong itemCount=0xFFFFFFFFL );
  484.         WBool IndirectUserData( WBool indirect );
  485.         void * GetRealUserData( WULong rowNumber, WULong columnNumber ) const;
  486.         WBool SetRealUserData( WULong rowNumber, WULong columnNumber,
  487.                                void * userData );
  488.         WBool GetNonEmptyRowRange( WULong & startRowNumber,
  489.                                    WULong & endRowNumber ) const;
  490.         WULong GetNonEmptyRowCount() const;
  491.         WBool ResetColumnGap();
  492.         WBool ResetRowGap();
  493.         WBool IsSizing( const WPoint & point, WBool * vertical );
  494.         WBool DrawSizingLine( WBool vertical, WULong rowNumber,
  495.                               WULong columnNumber, WPoint * currPoint=NULL,
  496.                               WBool eraseOnly=FALSE );
  497.         WBool SelectiveInvalidate( WULong oldTopRowNum, WULong oldLeftColNum,
  498.                                    WULong oldSelEndRowNum,
  499.                                    WULong oldSelEndColNum );
  500.         WBool AllocDTTable();
  501.         void UpdateExtents( WInt count );
  502.         WBool UpdateHorizontalScrollbars();
  503.         WBool UpdateVerticalScrollbars();
  504.  
  505.     protected:
  506.         WBool doDataTargetScroll();
  507.  
  508.         /**************************************************************
  509.          * Data Members
  510.          **************************************************************/
  511.  
  512.     protected:
  513.  
  514.         WGridData                 _data;
  515.         WWindow *                 _editor;
  516.         WShort                    _headerHeight;
  517.         WShort                    _headerWidth;
  518.         WULong                    _selectedRowNum;
  519.         WULong                    _selectedColNum;
  520.         WRect                     _sizingRect;
  521.         WULong                    _sizingNumber;
  522.         WPoint                    _sizingPos;
  523.         WULong                    _rowCount;
  524.         WULong                    _colCount;
  525.         WULong                    _selectedEndRowNum;
  526.         WULong                    _selectedEndColNum;
  527.         WULong                    _rowGap;
  528.         WULong                    _colGap;
  529.         WDataTargetTable *        _dataTargetTable;
  530.         WLong                     _addRow;
  531.         WLong                     _lastScrollPos;
  532.         WLong                     _scrollUp;
  533.         WLong                     _scrollDown;
  534.         // TODO: Put these into flags
  535.         WBool                     _liveEditMode;
  536.         WBool                     _editting;
  537.         WBool                     _showVertHeader;
  538.         WBool                     _showHorzHeader;
  539.         WBool                     _readOnly;
  540.         WBool                     _headerSizing;
  541.         WBool                     _verticalSizing;
  542.         WBool                     _horizontalSizing;
  543.         WBool                     _selecting;
  544.         WBool                     _allowVertSizing;
  545.         WBool                     _allowHorzSizing;
  546.         WBool                     _fullRowSelect;
  547.         WBool                     _rowLines;
  548.         WBool                     _colLines;
  549.         WBool                     _useTabs;
  550.         WBool                     _multiSelect;
  551.         WBool                     _dataFilling;
  552.         WBool                     _wasPainting;
  553.         WBool                     _ignoreItemChanged;
  554.         WBool                     _indirectUserData;
  555.         WBool                     _ignoreDataAvailableMove;
  556.         WBool                     _scrolling;
  557.         WLong                     _dataGuardRowOffset;
  558.         WBool                     _liveScrollMode;
  559.         WBool                     _buttonDown;
  560.         WBool                     _cancelEditting;
  561.         WLong                     _dataGuardRowSelected;
  562.         WLong                     _dataGuardRowSelection;
  563. };
  564.  
  565. #pragma warning 849 1
  566.  
  567. #endif
  568.